import VueI18n from 'vue-i18n'
import Vue from 'vue'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import enLocale from 'element-ui/lib/locale/lang/en'

Vue.use(VueI18n) // 通过插件的形式挂载
if(! localStorage.local){
    localStorage.local = 'zh-CN';
}
const i18n = new VueI18n({
    locale: localStorage.local,    // 语言标识
    //this.$i18n.locale // 通过切换locale的值来实现语言切换
    messages: {
        'zh-CN': Object.assign(require('./zh'), zhLocale),
        'en-US': Object.assign(require('./en'), enLocale),
    }
})
export default i18n;
